import 'package:flutter/material.dart';
import 'constant.dart' show Appcolors;

class Conversation {
  final String avatar;
  final String title;
  final int titleColor;
  final int type;
  final String des;
  final String updateAt;
  final bool isMute;
  final int unreadMsgCount;
  final bool displayDot;

  const Conversation({
    @required this.avatar,
    @required this.title,
    @required this.type,
    @required this.updateAt,
    this.des,
    this.isMute: false,
    this.unreadMsgCount: 0,
    this.displayDot: false,
    this.titleColor: Appcolors.TitleTextColor,
  })
      : assert(avatar != null),
        assert(title != null),
        assert(updateAt != null);

  getType() {
    return this.type;
  }

  isFromNet() {
    if (this.avatar.indexOf('http') == 0 || this.avatar.indexOf('https') == 0) {
      return true;
    } else {
      return false;
    }
  }
}



const List<Conversation> mockChatListData = [
  const Conversation(
    avatar: 'images/ic_file_transfer.png',
    title: '文件传输助手',
    des: '',
    updateAt: '19:56',
    type: 0,
  ),
  const Conversation(
    avatar: 'images/ic_tx_news.png',
    title: '腾讯新闻',
    des: '未来需要有可以战胜tx的公司',
    updateAt: '17:20',
    type: 0,
  ),
  const Conversation(
    avatar: 'images/ic_wx_games.png',
    title: '微信游戏',
    titleColor: 0xff586b95,
    des: '活力全开',
    updateAt: '17:12',
    type: 0,
  ),
  const Conversation(
    avatar: 'https://randomuser.me/api/portraits/women/60.jpg',
    title: 'LingN',
    des: '今晚要一起去吃鸡吗？',
    updateAt: '17:56',
    type: 1,
    isMute: true,
    unreadMsgCount: 2,
  ),
  const Conversation(
    avatar: 'https://randomuser.me/api/portraits/women/85.jpg',
    title: 'YoTina',
    des: '晚自习是什么来着？你知道吗，看到的话赶紧回复我',
    updateAt: '17:58',
    type: 1,
    isMute: false,
    unreadMsgCount: 3,
  ),
  const Conversation(
    avatar: 'https://randomuser.me/api/portraits/women/66.jpg',
    title: 'AnNing',
    titleColor: 0xff586b95,
    des: '周末去爬山',
    updateAt: '17:12',
    type: 1,
  ),
  const Conversation(
    avatar: 'https://randomuser.me/api/portraits/men/41.jpg',
    title: 'Lily',
    des: '明天去跑步',
    updateAt: '昨天',
    type: 1,
    isMute: false,
    unreadMsgCount: 99,
  ),
  const Conversation(
    avatar: 'https://randomuser.me/api/portraits/men/62.jpg',
    title: 'Ant',
    des: '今晚要一起去吃肯德基吗？',
    updateAt: '17:56',
    type: 1,
    isMute: true,
    unreadMsgCount: 300,
  ),
  const Conversation(
    avatar: 'https://randomuser.me/api/portraits/women/10.jpg',
    title: 'MorLi',
    des: '晚自习是什么来着？你知道吗，看到的话赶紧回复我',
    updateAt: '17:58',
    type: 1,
    isMute: false,
    unreadMsgCount: 3,
  ),
  const Conversation(
    avatar: 'https://randomuser.me/api/portraits/women/57.jpg',
    title: 'Lily',
    des: '今天要去运动场锻炼吗？',
    updateAt: '昨天',
    type: 1,
    isMute: false,
    unreadMsgCount: 0,
  ),
  const Conversation(
    avatar: 'https://ww1.sinaimg.cn/large/0065oQSqly1ftdtot8zd3j30ju0pt137.jpg',
    title: 'YANL',
    des: '今晚要一起去吃肯德基吗？',
    updateAt: '17:56',
    type: 1,
    isMute: true,
    unreadMsgCount: 0,
  ),
  const Conversation(
    avatar: 'https://randomuser.me/api/portraits/women/10.jpg',
    title: 'Tinan',
    des: '晚自习是什么来着？你知道吗，看到的话赶紧回复我',
    updateAt: '17:58',
    type: 1,
    isMute: false,
    unreadMsgCount: 1,
  ),
  const Conversation(
    avatar: 'https://randomuser.me/api/portraits/men/27.jpg',
    title: 'LilyMe',
    des: '今天要去运动场锻炼吗？',
    updateAt: '昨天',
    type: 1,
    isMute: false,
    unreadMsgCount: 0,
  ),
];
